package com.jiangjiang.eshop.wms.convert;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiangjiang.eshop.customer.dto.ReturnGoodsWorksheetDTO;
import com.jiangjiang.eshop.order.dto.OrderInfoDTO;
import com.jiangjiang.eshop.order.dto.OrderItemDTO;
import com.jiangjiang.eshop.wms.domain.ReturnGoodsInputOrder;
import com.jiangjiang.eshop.wms.dto.ReturnGoodsInputOrderDTO;
import com.jiangjiang.eshop.wms.dto.ReturnGoodsInputOrderItemDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.TargetType;

import java.util.List;

/**
 * 转换类
 */
@Mapper(componentModel = "spring")
public interface ReturnGoodsInputOrderConvert {

    @Mappings({
            @Mapping(target = "id",ignore = true),
            @Mapping(target = "gmtCreate",ignore = true),
            @Mapping(target = "gmtModified",ignore = true),
            @Mapping(target = "orderId",source = "orderInfo.id"),
            @Mapping(target = "returnGoodsWorksheetId",source = "returnGoodsWorksheet.id"),
            @Mapping(target = "returnGoodsReason",source = "returnGoodsWorksheet.returnGoodsReason"),
            @Mapping(target = "returnGoodsRemark",source = "returnGoodsWorksheet.returnGoodsRemark"),
            @Mapping(target = "orderNo",source = "orderInfo.orderNo")
    })
    ReturnGoodsInputOrderDTO convertOrderInfoAndReturnGoodsWorksheet2DTO(OrderInfoDTO orderInfo, ReturnGoodsWorksheetDTO returnGoodsWorksheet);


    @Mappings({
            @Mapping(target = "id",ignore = true),
            @Mapping(target = "gmtCreate",ignore = true),
            @Mapping(target = "gmtModified",ignore = true)
    })
    ReturnGoodsInputOrderItemDTO convertOrderItem2InputOrderIntemDTO(OrderItemDTO orderItems);


    List<ReturnGoodsInputOrderItemDTO> convertOrderItems2InputOrderIntemDTOList(List<OrderItemDTO> orderItems);

    ReturnGoodsInputOrder convertDTO2Entity(ReturnGoodsInputOrderDTO dto);

    Page<ReturnGoodsInputOrderDTO> convertPage2DTO(Page<ReturnGoodsInputOrder> selectPage);

    ReturnGoodsInputOrderDTO convertEntity2DTO(ReturnGoodsInputOrder returnGoodsInputOrder);

}
